home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c++,comp.lang.c
- Subject: Re: Hungarian notation
- Date: Wed, 17 Jan 96 15:01:10 GMT
- Organization: none
- Message-ID: <821890870snz@genesis.demon.co.uk>
- References: <4dhkae$an9@blackice.winternet.com>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <4dhkae$an9@blackice.winternet.com>
- jdege@winternet.com "Jeff Dege" writes:
-
- > Generally speaking, when I use printf(), et al., with integer types
- >of uncertain or unknown size, I explicitly cast. i.e.:
- >
- >printf("The current epoch is %ld\n", (long) time(NULL));
- >
- > This is, as far as I know, the only safe way to printf() a time_t,
- >size_t, etc.
-
- There is no guarantee that time_t is an integer. To print it safely you
- should cast it to long double. size_t is guaranteed to be an unsigned
- integer so it should be cast to unsigned long for printing.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-